import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.regex.Matcher;
import java.util.regex.Pattern;


public class AddTag {
	public static void main(String[] args){
		String url = new String("c://newFile.txt");
		
		BufferedReader reader = null;
		BufferedWriter writer = null;
		try{
			reader = new BufferedReader(new InputStreamReader(new FileInputStream(url)));
			String line = new String();
			String newFile = "newFile1.txt";
			writer = new BufferedWriter(new FileWriter("c://"+newFile));
			
			while((line = reader.readLine())!=null){
				Pattern expression = Pattern.compile("<Conflict>[a-zA-Z0-9,.:;`'@#$%^&! ]*</Conflict>");
				Matcher matcher = expression.matcher(line);
				if(matcher.find()){
					String temp = matcher.group();
					String content = temp.substring(10, temp.length()-12);
					String newStr = "<Other value=\"Conflict\">"+content+"</Other>";
					writer.write(newStr+'\n');
				}else{
					writer.write(line+'\n');
				}
				
			}
			writer.flush();
			reader.close();
		}catch(FileNotFoundException e){
			e.printStackTrace();
		}catch(IOException e){
			e.printStackTrace();
		}
	}
}
